package com.wjh.kt_vod.controller;

import com.wjh.kt_vod.result.Result;
import com.wjh.kt_vod.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Api(tags = "文件上传接口")
@RestController
@RequestMapping("/admin/vod/file")
public class FileUploadController {

    @Autowired
    @Qualifier("fileServiceImpl")
    private FileService fileService;

    @ApiOperation(value = "头像上传")
    @PostMapping("/upload")
    public Result uploadFile(MultipartFile multipartFile){
        String url = fileService.upload(multipartFile);
        return Result.ok(url).code(20000).message("上传文件成功");
    }


}
